//
//  NSTimer+ZJSRetain.m
//  zjsapp
//
//  Created by 杜志 on 2019/1/11.
//  Copyright © 2019 njmd. All rights reserved.
//

#import "NSTimer+ZJSRetain.h"

@implementation NSTimer (ZJSRetain)


///类对象的系统自动释放
+ (NSTimer *)zjs_scheduledTimerWithTimeInterval:(NSTimeInterval)inerval repeats:(BOOL)repeats block:(void (^)(NSTimer *timer))block{
    
    return [NSTimer scheduledTimerWithTimeInterval:inerval target:self selector:@selector(zjs_blcokInvoke:) userInfo:[block copy] repeats:repeats];
}

+ (void)zjs_blcokInvoke:(NSTimer *)timer {
    
    void (^block)(NSTimer *timer) = timer.userInfo;
    
    if (block) {
        block(timer);
    }
}

@end
